﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LRS.DAL;
using LRS.DTO;
namespace LRS.BLL
{
    public static class bEmployee
    {
        public static bool ValidateAccount(string username, string password)
        {
            eEmployee emp = dEmployee.GetEmployeeByUsernameAndPassword(username, password);
            if (emp == null)
                return false;
            else
            {
                LRSInfo.Username = emp.EmployeeNumber.Trim();
                LRSInfo.Type = emp.Type.Trim();
                LRSInfo.UserID = emp.EmployeeID;
                return true;
            }
        }
        public static List<eEmployee> GetEmployees()
        {
            return dEmployee.GetEmployees().Where(c=>c.EmployeeNumber.Equals(LRSInfo.Username)==false).ToList();
        }
        public static int GetNumberOfEmployee()
        {
            return dEmployee.GetNumberOfEmployee();
        }
        public static eEmployee GetEmployeeByID(int EmployeeID)
        {
            return dEmployee.GetEmployeeByID(EmployeeID);
        }
        public static string InsertAdmin(eEmployee Employee)
        {
            return dEmployee.InsertAdmin(Employee);
        }
        public static void InsertEmployee(eEmployee Employee)
        {
            dEmployee.InsertEmployee(Employee);
        }
        public static void UpdatePassword(int EmployeeID, string Password)
        {
            dEmployee.UpdatePassword(EmployeeID, Password);
        }
        public static void UpdateEmployee(eEmployee Employee)
        {
            dEmployee.UpdateEmployee(Employee);
        }
        public static void DeleteEmployeeByID(int EmpID)
        {
            dEmployee.DeleteEmployeeByID(EmpID);
        }
        public static List<eEmployee> GetEmployeesByKeyword(string keyword)
        {
            return dEmployee.GetEmployeesByKeyword(keyword);
        }
    }
}
